package com.reader.api.service.impl.comment;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.reader.api.entity.comment.ReaderComment;
import com.reader.api.mapper.comment.ReaderCommentMapper;
import com.reader.api.service.comment.IReaderCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @@description  服务实现类
 * @author        jiahaikun
 * @date          2018-11-09
 */
@Service
@Transactional
public class ReaderCommentServiceImpl extends ServiceImpl<ReaderCommentMapper, ReaderComment> implements IReaderCommentService {


@Autowired
private ReaderCommentMapper readerCommentMapper;

/**
 * @function 多表关联查询
 * @param     currentPage 当前页
 * @param     size 每页显示条数
 * @param     docId 内容ID
* @param      appUserId APP用户ID
 * @return
 */

    @Override
    public Page<LinkedHashMap<String, Object>> selectListPage(int currentPage, int size, String docId, Integer appUserId) {
            Page<LinkedHashMap<String, Object>> page = new Page<>(currentPage, size);// 当前页，总条数 构造 page 对象
            return page.setRecords(readerCommentMapper.selectListPage(page,docId,appUserId));
    }

}